﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace ScheduleMaker
{
    public partial class smConfigFile : Form
    {
        public smConfigFile()
        {
            InitializeComponent();
        }

        private void smConfigFile_Load(object sender, EventArgs e)
        {

        }

        private void createButton_Click(object sender, EventArgs e)
        {

        }

        private void importButton_Click(object sender, EventArgs e)
        {

        }

        private void startApp()
        {
            Form smLogin = new smLoginForm();
            smLogin.FormClosed += new FormClosedEventHandler(closeForm);
            smLogin.Show();
            this.Hide();
        }

        public void closeForm(object sender, FormClosedEventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form smCreateConfigForm = new smCreateConfig(this);
            smCreateConfigForm.Show();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                String sourcePath = openFileDialog.FileName;
                String destPath = Directory.GetCurrentDirectory() + "\\Config.conf";
                File.Copy(sourcePath, destPath, false);
                startApp();
            }
        }

    }
}
